package com.zf.yichat.api.config.Component;

import com.zf.yichat.api.dto.request.ChatroomRequest;
import com.zf.yichat.mapper.UserJoinChatroomMapper;
import com.zf.yichat.model.UserJoinChatroom;
import com.zf.yichat.utils.common.N3d;
import com.zf.yichat.utils.response.FsResponse;
import com.zf.yichat.utils.response.FsResponseGen;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;

/**
 * 聊天室相关组件
 */
@Component
public class ChatroomComponent {

    @Resource
    private UserJoinChatroomMapper userJoinChatroomMapper;

    /**
     * 查询用户是否在聊天室内
     * @param userId
     * @param chatroomId
     * @return
     */
    public boolean queryUserJoinChatroom(String userId, String chatroomId) {
            Integer count = userJoinChatroomMapper.queryUserJoinChatroom(chatroomId, userId);
            return count > 0;
    }
}
